package utils;

import java.util.Calendar;
import java.util.GregorianCalendar;

/**
 * The Class CurrentDate gives the current time in a formatted String.
 */
public class CurrentDate {

	/**
	 * Gets the current time in a String of the format hh:mm:ss dd/mm/yy.
	 * 
	 * @return the current time String
	 */
	public static String getCurrentTime(){
		Calendar calendar = GregorianCalendar.getInstance();

		int month = calendar.get(Calendar.MONTH)+1;		
		int year = calendar.get(Calendar.YEAR);
		int day = calendar.get(Calendar.DAY_OF_MONTH);
		int hour = calendar.get(Calendar.HOUR_OF_DAY);
		int minute = calendar.get(Calendar.MINUTE);
		int second = calendar.get(Calendar.SECOND);

		String dateString = hour+"."+minute+"."+second+" "+day+"-"+month+"-"+year;
		return dateString;
	}

	/**
	 * Gets the current date in a String of the format dd/mm/yy.
	 * 
	 * @return the current date String.
	 */
	public static String getCurrentDate(){
		Calendar calendar = GregorianCalendar.getInstance();

		int month = calendar.get(Calendar.MONTH)+1;		
		int year = calendar.get(Calendar.YEAR);
		int day = calendar.get(Calendar.DAY_OF_MONTH);

		String dateString = day+"|"+month+"|"+year;
		return dateString;
	}
}
